#include "DxfRenderModel.h"


DxfRenderModel::DxfRenderModel(void)
{
}


DxfRenderModel::~DxfRenderModel(void)
{
}

void DxfRenderModel::render( RenderContext* renderContext )
{
	for (auto iter = _dxLayers.begin(); iter != _dxLayers.end(); ++iter)
	{
		iter->second.render(renderContext);
	}
}

void DxfRenderModel::addEntity( const QString& layerName, DxfEntity* entity )
{
	_dxLayers[layerName].addEntity(entity);
}

DxfRenderModel::Envelope DxfRenderModel::getEnvelope() const
{
	Envelope envelope;
	for (auto iter = _dxLayers.begin(); iter != _dxLayers.end(); ++iter)
	{
		Envelope temp = iter->second.getEnvelope();
		if(!temp.isEmpty())
		{
			envelope.expandToInclude(temp);
		}		
	}
	return envelope;
}
